﻿<view:ViewPageBase x:Class="ASPItalia.ModelVirtualCasting.Silverlight.BackOffice.Views.Home"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                   xmlns:view="clr-namespace:ASPItalia.ModelVirtualCasting.Silverlight.BackOffice.Views"
                   xmlns:viewmodel="clr-namespace:ASPItalia.ModelVirtualCasting.Silverlight.BackOffice.ViewModels"
                   xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
                   xmlns:Behaviors="clr-namespace:ASPItalia.ModelVirtualCasting.Silverlight.BackOffice.Behaviors"
                   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                   xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                   xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
                   xmlns:Command="clr-namespace:ASPItalia.ModelVirtualCasting.Silverlight.BackOffice.Command"
                   mc:Ignorable="d"
                   xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                   d:DesignWidth="640"
                   d:DesignHeight="480"
                   Title="Home Page">
  <view:ViewPageBase.ViewModel>
    <viewmodel:HomeViewModel />
  </view:ViewPageBase.ViewModel>
  <Grid x:Name="LayoutRoot">
    <data:DataGrid x:Name="dg1"
                   AutoGenerateColumns="False"
                   ItemsSource="{Binding People}"
                   Command:DoubleClick.Command="{Binding ViewDetailsCommand, Mode=OneWay}"
                   Command:DoubleClick.CommandParameter="{Binding SelectedItem, ElementName=dg1, Mode=OneWay}"
                   IsReadOnly="True">
      <i:Interaction.Triggers>
        <i:EventTrigger EventName="SelectionChanged">
          <cmd:EventToCommand Command="{Binding SelectionChangedCommand, Mode=OneWay}"
                              CommandParameter="{Binding SelectedItems, ElementName=dg1}" />
        </i:EventTrigger>
      </i:Interaction.Triggers>
     <data:DataGrid.Columns>
        <data:DataGridTextColumn  Binding="{Binding ID}"
                                 IsReadOnly="True"
                                 
                                 MaxWidth="40"
                                 Header="ID"
                                 Width="SizeToHeader"></data:DataGridTextColumn>
        <data:DataGridTemplateColumn Header="Foto">
          <data:DataGridTemplateColumn.CellTemplate>
            <DataTemplate>

              <Image Source="{Binding Multimedia, Converter={StaticResource FirstImageConverter}}"
                       Width="70" Height="100" />
            </DataTemplate>
          </data:DataGridTemplateColumn.CellTemplate>
        </data:DataGridTemplateColumn>
        <data:DataGridTextColumn Binding="{Binding FirstName}" 
                                 Header="Nome"></data:DataGridTextColumn>
        <data:DataGridTextColumn Binding="{Binding LastName}"
                                 Header="Cognome"></data:DataGridTextColumn>
        <data:DataGridTextColumn Binding="{Binding EmailAddress}"
                                 Header="Email"></data:DataGridTextColumn>
        <data:DataGridTextColumn Binding="{Binding ResidenceCity}"
                                 Header="Città"></data:DataGridTextColumn>
        <data:DataGridCheckBoxColumn Binding="{Binding Availability}"
                                     Header="Disponibilità" />
      </data:DataGrid.Columns>
      
    </data:DataGrid>
  </Grid>
</view:ViewPageBase>
